//
//  TestViewController.m
//  trj
//
//  Created by 小小算盘 on 15/11/5.
//  Copyright © 2015年 trj-xsp. All rights reserved.
//

#import "TestViewController.h"
//#import "Utility2.h"
//#import "MBProgressHUD.h"
//#import "NavView.h"
@interface TestViewController ()<UIWebViewDelegate,UIGestureRecognizerDelegate>
{
    UIWebView *_webView;
}
@end

@implementation TestViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.navigationItem.title = @"抽奖";
    
   
    NSString *str = @"CZfSDQzsuDayjfzE";
    NSString *str1 =@"12345678";
    
    NSString *token_id=[Utility encryptStr:[NSString stringWithFormat:@"%@",[Sun getUser:ACCESSID]]  Key:str1 IV:nil];
    //MD5
    NSString *md5Str=[Utility md5:[NSString stringWithFormat:@"source=ios&token_id=%@&type=%@&%@",token_id,self.type,str]];
   // NSString *url = [NSString stringWithFormat:@"%@",KURL];
    NSURL *url = [NSURL URLWithString:[NSString stringWithFormat:@"%@/draw/app?source=ios&token_id=%@&type=%@&sign=%@",KWAP,token_id,self.type,md5Str]];
    NSLog(@"抽奖url%@",url);
    NSURLRequest* request = [NSURLRequest requestWithURL:url];
//    NSURLSession *request = ];
    _webView = [[UIWebView alloc] initWithFrame:self.view.bounds];
    _webView.delegate = self;
    [_webView loadRequest:request];
    [_webView setScalesPageToFit:YES];
    [self.view addSubview:_webView];
}
-(void)webViewDidStartLoad:(UIWebView *)webView
{
[MBProgressHUD showHUDAddedTo:self.view animated:YES];

}
-(void)webViewDidFinishLoad:(UIWebView *)webView
{
    [MBProgressHUD hideHUDForView:self.view animated:YES];
}



@end
